package me.jessyan.mvparms.demo.mvp.ui.activity.specialoffer;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;

import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import me.jessyan.mvparms.demo.R;
import me.jessyan.mvparms.demo.di.component.specialoffer.DaggerSpecialOfferComponent;
import me.jessyan.mvparms.demo.di.module.specialoffer.SpecialOfferModule;
import me.jessyan.mvparms.demo.mvp.contract.specialoffer.SpecialOfferContract;
import me.jessyan.mvparms.demo.mvp.presenter.specialoffer.SpecialOfferPresenter;
import me.jessyan.mvparms.demo.mvp.ui.widget.CustomToolbar;
import me.jessyan.mvparms.demo.utils.PerfectClickListener;

import static com.jess.arms.utils.Preconditions.checkNotNull;

/**
 * 优惠活动
 */
public class SpecialOfferActivity extends BaseActivity<SpecialOfferPresenter> implements SpecialOfferContract.View {

    @BindView(R.id.toolbar)
    CustomToolbar toolbar;

    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerSpecialOfferComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .specialOfferModule(new SpecialOfferModule(this))
                .build()
                .inject(this);
    }

    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_special_offer; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        findViewById(R.id.iv).setOnClickListener(new PerfectClickListener() {
            @Override
            protected void onNoDoubleClick(View v) {
                startActivity(new Intent(SpecialOfferActivity.this, LongPicActivity.class));
            }
        });
toolbar.setListener(new CustomToolbar.ToolbarListener() {
    @Override
    public void onLeftBack() {
        finish();
    }

    @Override
    public void onRightBack() {

    }
});

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.snackbarText(message);
    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }

}
